package fm.sys.token;

import org.apache.shiro.authc.HostAuthenticationToken;
import org.apache.shiro.authc.RememberMeAuthenticationToken;

/**
 * Created by CM on 17/5/10.
 */
public class MerchantToken implements HostAuthenticationToken, RememberMeAuthenticationToken {
    private String openid;
    private String phone;
    private String vrcd;
    private String token;

    public MerchantToken(String phone, String vrcd) {
        this.phone = phone;
        this.vrcd = vrcd;
    }

    public MerchantToken(String token) {
        this.token = token;
    }

    @Override
    public String getHost() {
        return null;
    }

    @Override
    public boolean isRememberMe() {
        return false;
    }

    @Override
    public Object getPrincipal() {
        return phone == null ? token : phone;
    }

    @Override
    public Object getCredentials() {
        return vrcd == null ? token : vrcd;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }
}
